﻿<%@ Page Title="Trails List"  Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="TrailList.aspx.cs" Inherits="UI_TrailList" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
    <style type="text/css">
        .style1
        {
            width: 100%;
        }
    </style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
    <table class="style1" border="0">
        <tr>
            <td align="center" colspan="2" >
                <asp:HyperLink ID="hprViewmap" runat="server" CssClass="links" Text="View Results on Map"></asp:HyperLink>
            </td>
        </tr>
        <tr>
            <td class="arial__big_heading_colored" align="left"> 
                Existing Trails</td>
            <td align="right" class="labelstyle">
                Sort by:
               <%-- <asp:LinkButton ID="hprDateAdded" runat="server" Text="Date Added" CssClass="links" 
                    onclick="hprDateAdded_Click" ></asp:LinkButton> | 
                <asp:LinkButton ID="hpyType" runat="server" Text="Type" onclick="hpyType_Click" CssClass="links"></asp:LinkButton> | --%>
                <asp:LinkButton ID="hprLocation" runat="server" Text="Location" CssClass="links" 
                    onclick="hprLocation_Click"></asp:LinkButton> | 
                <asp:LinkButton ID="hprTotalComments" runat="server" Text="number of Comments" CssClass="links"
                    onclick="hprTotalComments_Click"></asp:LinkButton>               
                </td>
        </tr>
        <tr>
            <td colspan="2" align="left" valign="top">
            <asp:Label ID="lblMsg" runat="server" Font-Size="12px" ForeColor="Red" Text="No trail found..." Visible="false"></asp:Label>
                <asp:GridView ID="dlTrailList" AutoGenerateColumns="false" runat="server" DataKeyField="ID" Width="70%"                     
                   OnRowDataBound="dlTrailList_databound" GridLines="None" AllowPaging="true" PageSize="10"
                    onpageindexchanging="dlTrailList_PageIndexChanging">
                    
                    <PagerSettings Position="Bottom" Mode="NextPreviousFirstLast" PreviousPageText="< previous"
                    NextPageText="next >" FirstPageText="<< first" LastPageText="last >>" /> 
                    
                    <PagerStyle HorizontalAlign="Right" CssClass="labelColoredGrid"/>                    
                   
                    <Columns>
                    <asp:TemplateField> <ItemTemplate>
                        <table class="style1" border="0" style="background-color:White;">
                            <tr>
                                <td width="60%" valign="top" align="left"> 
                                    <table class="style1" border="0">
                                        <tr>
                                            <td align="left">
                                                <asp:HyperLink ID="lblTrailName" NavigateUrl='<%#Eval("id","~/UI/trail-details.aspx?TrailID={0}") %>' runat="server" Text="<%# Bind('Name') %>" 
                                                    CssClass="links"></asp:HyperLink>
                                                &nbsp;|
                                                <asp:Label ID="lblLocation" runat="server" 
                                                    Text='<%# Bind("LocationCountry") %>' CssClass="labelstyleBold"></asp:Label>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td align="left"><a class="links" href='#'><%# Eval("Information") %></a>                                                
                                                &nbsp;|
                                                <a class="links" href='#'><%# Eval("LocationCountry")%></a>
                                               
                                            </td>
                                        </tr>
                                        <tr>
                                            <td align="left">
                                                <asp:Label CssClass="labelstyle" ID="lblStory" runat="server" Text='<%# Bind("TripStory") %>'></asp:Label>
                                            </td>
                                        </tr>
                                    </table>
                                </td>
                                <td>
                                    <table class="style1">
                                        <tr>
                                            <td align="left">
                                            <asp:Literal ID="ltrImages" Visible="false" runat="server" Text='<%# Bind("ID") %>'></asp:Literal>
                                            <asp:DataList id="lstImages" runat="server" RepeatColumns="3" RepeatDirection="Horizontal" OnItemDataBound="lstImages_databound">
                                                <ItemTemplate>
                                                    <asp:Image BorderColor="#ababab" BorderStyle="Solid" BorderWidth="4px" runat="server" ID="imgTrial" 
                                                     ImageUrl='<%# Eval("Picture") %>'/>
                                                </ItemTemplate>
                                            </asp:DataList>
                                           &nbsp;</td>
                                        </tr>
                                        <tr>
                                            <td align="left" class="labelstyleBold">
                                                No. of comments : <asp:Label ID="lblNoComments" runat="server" Text='<%# Bind("TrailComments") %>'
                                                    CssClass="label_font"></asp:Label>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td align="left" class="labelstyleBold">
                                                Added by : <a class="links" href='userDetail.aspx?uid=<%# Eval("UserID") %>'><%# Eval("username") %></a>
                                            </td>
                                        </tr>
                                    </table>
                                </td>
                            </tr>
                        </table><br />
                    </ItemTemplate>                   
                    </asp:TemplateField>
                    </Columns> 
                    
                </asp:GridView>
                <asp:Label ID="lblshowCount" runat="server" CssClass="labelColored"></asp:Label>
            </td>
        </tr>
    </table>
</asp:Content>

